
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>028 注解 · 书名</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        <meta name="author" content="作者">
        <meta name="identifier" content="图书编号" scheme="ISBN">
        
    
    <link rel="stylesheet" href="../../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-search-pro/search.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-code/plugin.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-back-to-top-button/plugin.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-intopic-toc/style.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-flexible-alerts/style.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-expandable-chapters/expandable-chapters.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-theme-comscore/test.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="029 Lambda表达式.html" />
    
    
    <link rel="prev" href="027XML解析.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../../">
            
                <a href="../../">
            
                    
                    书名
            
                </a>
            

            
        </li>
    

    
        
        <li class="header">Books</li>
        
        
    
        <li class="chapter " data-level="2.1" >
            
                <span>
            
                    
                    Java
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.1.1" data-path="001环境变量.html">
            
                <a href="001环境变量.html">
            
                    
                    001环境变量
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.2" data-path="002Java初体验.html">
            
                <a href="002Java初体验.html">
            
                    
                    002Java初体验
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.3" data-path="003变量命名及数据类型.html">
            
                <a href="003变量命名及数据类型.html">
            
                    
                    003变量命名及数据类型
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.4" data-path="004运算符.html">
            
                <a href="004运算符.html">
            
                    
                    004运算符
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.5" data-path="005选择结构.html">
            
                <a href="005选择结构.html">
            
                    
                    005选择结构
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.6" data-path="006循环结构.html">
            
                <a href="006循环结构.html">
            
                    
                    006循环结构
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.7" data-path="007数组.html">
            
                <a href="007数组.html">
            
                    
                    007数组
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.8" data-path="008类和对象方法.html">
            
                <a href="008类和对象方法.html">
            
                    
                    008类和对象方法
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.9" data-path="009构造方法.html">
            
                <a href="009构造方法.html">
            
                    
                    009构造方法
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.10" data-path="010封装与关键字static.html">
            
                <a href="010封装与关键字static.html">
            
                    
                    010封装与关键字Static
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.11" data-path="011 继承.html">
            
                <a href="011 继承.html">
            
                    
                    011 继承
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.12" data-path="012方法重写.html">
            
                <a href="012方法重写.html">
            
                    
                    012方法重写
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.13" data-path="013多态.html">
            
                <a href="013多态.html">
            
                    
                    013多态
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.14" data-path="014抽象类抽象方法.html">
            
                <a href="014抽象类抽象方法.html">
            
                    
                    014抽象类抽象方法
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.15" data-path="015接口.html">
            
                <a href="015接口.html">
            
                    
                    015接口
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.16" data-path="016异常.html">
            
                <a href="016异常.html">
            
                    
                    016异常
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.17" data-path="017集合.html">
            
                <a href="017集合.html">
            
                    
                    017集合
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.18" data-path="017集合2.html">
            
                <a href="017集合2.html">
            
                    
                    017集合2
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.19" data-path="018泛型.html">
            
                <a href="018泛型.html">
            
                    
                    018泛型
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.20" data-path="019Collections算法类.html">
            
                <a href="019Collections算法类.html">
            
                    
                    019Collections算法类
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.21" data-path="020枚举.html">
            
                <a href="020枚举.html">
            
                    
                    020枚举
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.22" data-path="021包装类.html">
            
                <a href="021包装类.html">
            
                    
                    021包装类
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.23" data-path="022常用类.html">
            
                <a href="022常用类.html">
            
                    
                    022常用类
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.24" data-path="023File类.html">
            
                <a href="023File类.html">
            
                    
                    023File类
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.25" data-path="024IO流.html">
            
                <a href="024IO流.html">
            
                    
                    024IO流
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.26" data-path="025多线程.html">
            
                <a href="025多线程.html">
            
                    
                    025多线程
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.27" data-path="025多线程线程池.html">
            
                <a href="025多线程线程池.html">
            
                    
                    025多线程线程池
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.28" data-path="026网络编程Socket.html">
            
                <a href="026网络编程Socket.html">
            
                    
                    026网络编程Socket
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.29" data-path="027XML解析.html">
            
                <a href="027XML解析.html">
            
                    
                    027XML解析
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="2.1.30" data-path="028 注解.html">
            
                <a href="028 注解.html">
            
                    
                    028 注解
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.31" data-path="029 Lambda表达式.html">
            
                <a href="029 Lambda表达式.html">
            
                    
                    029 Lambda表达式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.32" data-path="029 反射.html">
            
                <a href="029 反射.html">
            
                    
                    029 反射
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.2" >
            
                <span>
            
                    
                    Mybatis
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.2.1" data-path="../mybatis/MyBatis.html">
            
                <a href="../mybatis/MyBatis.html">
            
                    
                    MyBatis
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.2.1.1" >
            
                <span>
            
                    
                    MyBatis
            
                </span>
            

            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.3" >
            
                <span>
            
                    
                    Mysql
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.3.1" data-path="../mysql/01 SQL通用语法.html">
            
                <a href="../mysql/01 SQL通用语法.html">
            
                    
                    01 SQL通用语法
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.3.2" data-path="../mysql/02 DDL.html">
            
                <a href="../mysql/02 DDL.html">
            
                    
                    02 DDL
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.3.3" data-path="../mysql/03 DML.html">
            
                <a href="../mysql/03 DML.html">
            
                    
                    03 DML
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.3.4" data-path="../mysql/04 DQL.html">
            
                <a href="../mysql/04 DQL.html">
            
                    
                    04 DQL
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.3.5" data-path="../mysql/05 DCL.html">
            
                <a href="../mysql/05 DCL.html">
            
                    
                    05 DCL
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.3.6" data-path="../mysql/06 函数.html">
            
                <a href="../mysql/06 函数.html">
            
                    
                    06 函数
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.3.7" data-path="../mysql/07 约束.html">
            
                <a href="../mysql/07 约束.html">
            
                    
                    07 约束
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.3.8" data-path="../mysql/08 多表查询.html">
            
                <a href="../mysql/08 多表查询.html">
            
                    
                    08 多表查询
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.3.9" data-path="../mysql/09 事务.html">
            
                <a href="../mysql/09 事务.html">
            
                    
                    09 事务
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.3.10" data-path="../mysql/999zzz.html">
            
                <a href="../mysql/999zzz.html">
            
                    
                    999zzz
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.3.11" data-path="../mysql/MySql.html">
            
                <a href="../mysql/MySql.html">
            
                    
                    MySql
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.3.12" data-path="../mysql/sql.html">
            
                <a href="../mysql/sql.html">
            
                    
                    Sql
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.4" >
            
                <span>
            
                    
                    Spring
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.4.1" data-path="../spring/spring.html">
            
                <a href="../spring/spring.html">
            
                    
                    Spring
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.5" >
            
                <span>
            
                    
                    SpringMVC
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.5.1" data-path="../springMVC/springMVC.html">
            
                <a href="../springMVC/springMVC.html">
            
                    
                    SpringMVC
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.6" >
            
                <span>
            
                    
                    整合
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.6.1" data-path="../整合/Mybatis框架.html">
            
                <a href="../整合/Mybatis框架.html">
            
                    
                    Mybatis框架
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.6.2" data-path="../整合/SpringBoot.html">
            
                <a href="../整合/SpringBoot.html">
            
                    
                    SpringBoot
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.6.3" data-path="../整合/springmvc框架.html">
            
                <a href="../整合/springmvc框架.html">
            
                    
                    Springmvc框架
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.6.4" data-path="../整合/spring框架.html">
            
                <a href="../整合/spring框架.html">
            
                    
                    Spring框架
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../.." >028 注解</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h1 id="&#x6CE8;&#x89E3;-javaannotation">&#x6CE8;&#x89E3; Java.Annotation</h1>
<h2 id="&#x4EC0;&#x4E48;&#x662F;&#x6CE8;&#x89E3;">&#x4EC0;&#x4E48;&#x662F;&#x6CE8;&#x89E3;</h2>
<ul>
<li>Annotation&#x662F; JDK 5 &#x5F00;&#x59CB;&#x5F15;&#x5165;&#x7684;&#x65B0;&#x6280;&#x672F;</li>
<li>Annotation&#x7684;&#x4F5C;&#x7528;<ul>
<li>&#x4E0D;&#x662F;&#x7A0B;&#x5E8F;&#x672C;&#x8EAB;, &#x53EF;&#x4EE5;&#x5BF9;&#x505A;&#x51FA;&#x89E3;&#x91CA;,(&#x8FD9;&#x4E00;&#x70B9;&#x548C;&#x6CE8;&#x91CA;(comment)&#x6CA1;&#x4EC0;&#x4E48;&#x533A;&#x522B;</li>
<li>&#x53EF;&#x4EE5;&#x88AB;&#x5176;&#x4ED6;&#x7A0B;&#x5E8F;(&#x6BD4;&#x5982;:&#x7F16;&#x8BD1;&#x5668;) &#x8BFB;&#x53D6;</li>
</ul>
</li>
<li>Annotation&#x7684;&#x683C;&#x5F0F;<ul>
<li>&#x6CE8;&#x89E3;&#x662F;&#x4EE5; <code>@&#x6CE8;&#x91CA;&#x540D;</code> &#x5728;&#x4EE3;&#x7801;&#x4E2D;&#x5B58;&#x5728;&#x7684;, &#x8FD8;&#x6709;&#x53EF;&#x4EE5;&#x6DFB;&#x52A0;&#x4E00;&#x4E9B;&#x53C2;&#x6570;&#x503C;, &#x4F8B;</li>
<li>@SuppressWarnings(value=&quot;unchecked&quot;)</li>
</ul>
</li>
<li>Annotation &#x5728;&#x54EA;&#x91CC;&#x4F7F;&#x7528;<ul>
<li>&#x53EF;&#x4EE5;&#x9644;&#x52A0; package, calss , method, field &#x7B49;&#x4E0A;&#x9762;, &#x76F8;&#x5F53;&#x4E8E;&#x7ED9;&#x4ED6;&#x4EEC;&#x6DFB;&#x52A0;&#x4E86;&#x989D;&#x5916;&#x7684;&#x8F85;&#x52A9;&#x4FE1;&#x606F;,</li>
<li>&#x6211;&#x4EEC;&#x53EF;&#x4EE5;&#x901A;&#x8FC7;&#x53CD;&#x5C04;&#x673A;&#x5236;&#x7F16;&#x7A0B;&#x5B9E;&#x73B0;&#x5BF9;&#x8FD9;&#x4E9B;&#x5143;&#x6570;&#x636E;&#x7684;&#x8BBF;&#x95EE;</li>
</ul>
</li>
</ul>
<blockquote>
<p><strong>&#x6CE8;&#x89E3;:</strong>&#x5C31;&#x662F;&#x4EE3;&#x7801;&#x4E2D;&#x7684;&#x7279;&#x6B8A;&#x6807;&#x8BB0;, &#x8FD9;&#x4E9B;&#x6807;&#x8BB0;&#x5728; &#x7F16;&#x8BD1;, &#x7C7B;&#x52A0;&#x8F7D;, &#x8FD0;&#x884C;&#x65F6; &#x80FD;&#x88AB;&#x8BFB;&#x53D6;, &#x4ECE;&#x800C;&#x505A;&#x51FA;&#x76F8;&#x5BF9;&#x5E94;&#x7684;&#x5904;&#x7406;</p>
</blockquote>
<pre><code class="lang-java"><span class="hljs-comment">// &#x58F0;&#x660E; AnnoTest &#x6CE8;&#x89E3;</span>
<span class="hljs-meta">@Target</span>(ElementType.METHOD) <span class="hljs-comment">// &#x5143;&#x6CE8;&#x89E3;</span>
<span class="hljs-meta">@Retention</span>(RetentionPolicy.RUNTIME) <span class="hljs-comment">// &#x5143;&#x6CE8;&#x89E3;</span>
<span class="hljs-keyword">public</span> <span class="hljs-meta">@interface</span> AnnoTest {
    <span class="hljs-function">String <span class="hljs-title">name</span><span class="hljs-params">()</span> <span class="hljs-keyword">default</span> &quot;zs&quot;</span>;
}
</code></pre>
<p>Java &#x6CE8;&#x89E3;&#x4F7F;&#x7528; @interface &#x4FEE;&#x9970;, &#x6B64;&#x5916;&#x8FD8;&#x4F7F;&#x7528;&#x4E24;&#x4E2A;&#x5143;&#x6CE8;&#x89E3;, &#x5176;&#x4E2D; @target &#x4F20;&#x5165; ElementType.METHOD &#x8868;&#x793A;&#x8FD9;&#x4E2A; AnnoTest &#x6CE8;&#x89E3;&#x53EA;&#x80FD;&#x7528;&#x4E8E;<strong>&#x65B9;&#x6CD5;&#x4E0A;</strong>, &#x5728; @Retention &#x4E2D;&#x4F20;&#x5165;RetentionPolicy.RUNTIME  &#x7528;&#x6765;&#x8868;&#x793A;<strong>&#x8BE5;&#x6CE8;&#x89E3;&#x751F;&#x5B58;&#x671F;&#x662F;&#x8FD0;&#x884C;&#x65F6;</strong></p>
<h3 id="&#x6CE8;&#x89E3;&#x7684;&#x5143;&#x7D20;">&#x6CE8;&#x89E3;&#x7684;&#x5143;&#x7D20;</h3>
<p>&#x5B9A;&#x4E49;&#x5728;&#x6CE8;&#x89E3;&#x5185;&#x90E8;&#x7684;&#x53D8;&#x91CF;, &#x79F0;&#x4E4B;&#x4E3A; &#x5143;&#x7D20;. &#x6CE8;&#x89E3;&#x53EF;&#x4EE5;&#x6709;&#x5143;&#x7D20;&#x4E5F;&#x53EF;&#x4EE5;&#x6CA1;&#x6709;&#x5143;&#x7D20; &#x5982;: @Override</p>
<pre><code class="lang-java"><span class="hljs-meta">@Target</span>(ElementType.METHOD)
<span class="hljs-meta">@Retention</span>(RetentionPolicy.SOURCE)
<span class="hljs-keyword">public</span> <span class="hljs-meta">@interface</span> Override {
}
</code></pre>
<p>&#x5E26;&#x5143;&#x7D20;&#x7684;&#x81EA;&#x5B9A;&#x4E49;&#x6CE8;&#x89E3;</p>
<pre><code class="lang-Java"><span class="hljs-meta">@Target</span>({ElementType.METHOD})
<span class="hljs-meta">@Retention</span>(RetentionPolicy.RUNTIME)
<span class="hljs-meta">@Documented</span>
<span class="hljs-keyword">public</span> <span class="hljs-meta">@interface</span> NoRepeatSubmit {

    <span class="hljs-comment">/**
     * &#x9501;&#x5B9A;&#x65F6;&#x95F4;&#xFF0C;&#x9ED8;&#x8BA4;&#x5355;&#x4F4D;&#xFF08;&#x79D2;&#xFF09;
     */</span>
    <span class="hljs-function"><span class="hljs-keyword">long</span> <span class="hljs-title">lockTime</span><span class="hljs-params">()</span> <span class="hljs-keyword">default</span> 2L</span>;

}
</code></pre>
<h3 id="&#x6CE8;&#x89E3;&#x5143;&#x7D20;&#x7684;&#x57FA;&#x672C;&#x683C;&#x5F0F;">&#x6CE8;&#x89E3;&#x5143;&#x7D20;&#x7684;&#x57FA;&#x672C;&#x683C;&#x5F0F;</h3>
<pre><code>// &#x57FA;&#x672C;&#x683C;&#x5F0F;
&#x6570;&#x636E;&#x7C7B;&#x578B; &#x5143;&#x7D20;&#x540D;&#x79F0;();

// &#x5E26;&#x9ED8;&#x8BA4;&#x503C;
&#x6570;&#x636E;&#x7C7B;&#x578B; &#x5143;&#x7D20;&#x540D;&#x79F0;() default &#x9ED8;&#x8BA4;&#x503C;;
</code></pre><h3 id="&#x6CE8;&#x89E3;&#x5143;&#x7D20;&#x7684;&#x6570;&#x636E;&#x7C7B;&#x578B;">&#x6CE8;&#x89E3;&#x5143;&#x7D20;&#x7684;&#x6570;&#x636E;&#x7C7B;&#x578B;</h3>
<pre><code>&#x6240;&#x6709;&#x7684;&#x57FA;&#x672C;&#x6570;&#x636E;&#x7C7B;&#x578B;(byte, short, int, long, float, double, boolean, char)

String

Class

enum

Annotation

&#x53CA;&#x4EE5;&#x4E0A;&#x7C7B;&#x578B;&#x7684;&#x6570;&#x7EC4;
</code></pre><blockquote>
<p>&#x58F0;&#x660E;&#x6CE8;&#x89E3;&#x5143;&#x7D20;&#x65F6;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;&#x57FA;&#x672C;&#x6570;&#x636E;&#x7C7B;&#x578B;&#x4F46;&#x4E0D;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;&#x5176;&#x5305;&#x88C5;&#x7C7B;, &#x4E5F;&#x53EF;&#x4EE5;&#x4F7F;&#x7528; &#x6CE8;&#x89E3;&#x7C7B;&#x578B; &#x4F5C;&#x4E3A;&#x5143;&#x7D20;&#x7684;&#x6570;&#x636E;&#x7C7B;&#x578B;, &#x53EF;&#x4EE5;&#x5D4C;&#x5957;&#x4F7F;&#x7528;</p>
</blockquote>
<h3 id="&#x6CE8;&#x89E3;&#x7684;&#x4F7F;&#x7528;">&#x6CE8;&#x89E3;&#x7684;&#x4F7F;&#x7528;</h3>
<p>&#x6CE8;&#x89E3;&#x662F;&#x4EE5; <code>@&#x6CE8;&#x91CA;&#x540D;</code>&#x7684;&#x683C;&#x5F0F;&#x5728;&#x4EE3;&#x7801;&#x4E2D;&#x4F7F;&#x7528;</p>
<pre><code class="lang-java"><span class="hljs-keyword">public</span> <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">TestController</span> </span>{

    <span class="hljs-comment">// NoRepeatSubmit &#x6CE8;&#x89E3;&#x4FEE;&#x9970; save &#x65B9;&#x6CD5;&#xFF0C;&#x9632;&#x6B62;&#x91CD;&#x590D;&#x63D0;&#x4EA4;</span>
    <span class="hljs-meta">@NoRepeatSubmit</span>
    <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">static</span> <span class="hljs-keyword">void</span> <span class="hljs-title">save</span><span class="hljs-params">(Object o)</span></span>{
        <span class="hljs-comment">// &#x4FDD;&#x5B58;&#x903B;&#x8F91;</span>
    }

    <span class="hljs-comment">// &#x4E00;&#x4E2A;&#x65B9;&#x6CD5;&#x4E0A;&#x53EF;&#x4EE5;&#x6709;&#x591A;&#x4E2A;&#x4E0D;&#x540C;&#x7684;&#x6CE8;&#x89E3;</span>
    <span class="hljs-meta">@Deprecated</span>
    <span class="hljs-meta">@SuppressWarnings</span>(<span class="hljs-string">&quot;uncheck&quot;</span>)
    <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">static</span> <span class="hljs-keyword">void</span> <span class="hljs-title">getDate</span><span class="hljs-params">()</span></span>{

    }
}
</code></pre>
<h2 id="java&#x6CE8;&#x89E3;&#x7684;&#x5206;&#x7C7B;">Java&#x6CE8;&#x89E3;&#x7684;&#x5206;&#x7C7B;</h2>
<p>&#x5185;&#x7F6E;&#x6CE8;&#x89E3;:</p>
<pre><code class="lang-java"><span class="hljs-meta">@Override</span> <span class="hljs-meta">@Deprecated</span> ...
</code></pre>
<p>&#x5143;&#x6CE8;&#x89E3; ( &#x4FEE;&#x9970;&#x6CE8;&#x89E3;&#x7684;&#x6CE8;&#x89E3; ):</p>
<pre><code class="lang-Java"><span class="hljs-meta">@target</span> <span class="hljs-meta">@Retention</span> <span class="hljs-meta">@Documented</span> <span class="hljs-meta">@Inherited</span>
</code></pre>
<h3 id="&#x5185;&#x7F6E;&#x6CE8;&#x89E3;">&#x5185;&#x7F6E;&#x6CE8;&#x89E3;</h3>
<ul>
<li>@Override - &#x68C0;&#x67E5;&#x8BE5;&#x65B9;&#x6CD5;&#x662F;&#x91CD;&#x5199;&#x65B9;&#x6CD5;. &#x5982;&#x679C;&#x53D1;&#x73B0;&#x5176;&#x7236;&#x7C7B;, &#x6216;&#x8005;&#x5F15;&#x7528;&#x7684;&#x63A5;&#x53E3;&#x4E2D;&#x5E76;&#x6CA1;&#x6709;&#x8BE5;&#x65B9;&#x6CD5;&#x65F6;, &#x4F1A;&#x62A5;&#x7F16;&#x8BD1;&#x9519;&#x8BEF;.</li>
</ul>
<pre><code class="lang-java"><span class="hljs-meta">@Target</span>(ElementType.METHOD)
<span class="hljs-meta">@Retention</span>(RetentionPolicy.SOURCE)
<span class="hljs-keyword">public</span> <span class="hljs-meta">@interface</span> Override {
}
</code></pre>
<ul>
<li>@Deprecated - &#x6807;&#x8BB0;&#x8FC7;&#x65F6;&#x65B9;&#x6CD5;. &#x5982;&#x679C;&#x4F7F;&#x7528;&#x8BE5;&#x65B9;&#x6CD5;, &#x4F1A;&#x62A5;&#x7F16;&#x8BD1;&#x8B66;&#x544A;</li>
</ul>
<pre><code class="lang-Java"><span class="hljs-meta">@Documented</span>
<span class="hljs-meta">@Retention</span>(RetentionPolicy.RUNTIME)
<span class="hljs-meta">@Target</span>(value={CONSTRUCTOR, FIELD, LOCAL_VARIABLE, METHOD, PACKAGE, PARAMETER, TYPE})
<span class="hljs-keyword">public</span> <span class="hljs-meta">@interface</span> Deprecated {
}
</code></pre>
<h3 id="&#x5143;&#x6CE8;&#x89E3;">&#x5143;&#x6CE8;&#x89E3;</h3>
<p>&#x5143;&#x6CE8;&#x89E3;&#x5C31;&#x662F;&#x4FEE;&#x9970;&#x6CE8;&#x89E3;&#x7684;&#x6CE8;&#x89E3;</p>
<ul>
<li>@Target</li>
<li>@Retention</li>
<li>@Documented</li>
<li>@Inherited</li>
</ul>
<h4 id="target">@Target</h4>
<p>&#x7528;&#x6765;&#x6307;&#x5B9A;<strong>&#x6CE8;&#x89E3;&#x7684;&#x4F5C;&#x7528;&#x57DF;</strong>, ( &#x5982;&#x65B9;&#x6CD5;, &#x7C7B;,&#x6216; &#x5B57;&#x6BB5; ) , &#x5176;&#x4E2D; ElementType &#x662F;&#x679A;&#x4E3E;&#x7C7B;&#x578B;, &#x4EE3;&#x8868;&#x53EF;&#x80FD;&#x7684;&#x53D6;&#x503C;&#x8303;&#x56F4;</p>
<pre><code class="lang-Java"><span class="hljs-keyword">public</span> <span class="hljs-keyword">enum</span> ElementType {
    <span class="hljs-comment">/**&#x6807;&#x660E;&#x8BE5;&#x6CE8;&#x89E3;&#x53EF;&#x4EE5;&#x4F5C;&#x7528;&#x4E8E;&#x7C7B;&#x3001;&#x63A5;&#x53E3;&#xFF08;&#x5305;&#x62EC;&#x6CE8;&#x89E3;&#x7C7B;&#x578B;&#xFF09;&#x6216;enum&#x58F0;&#x660E;*/</span>
    TYPE,

    <span class="hljs-comment">/** &#x6807;&#x660E;&#x8BE5;&#x6CE8;&#x89E3;&#x53EF;&#x4EE5;&#x4F5C;&#x7528;&#x4E8E;&#x5B57;&#x6BB5;(&#x57DF;)&#x58F0;&#x660E;&#xFF0C;&#x5305;&#x62EC;enum&#x5B9E;&#x4F8B; */</span>
    FIELD,

    <span class="hljs-comment">/** &#x6807;&#x660E;&#x8BE5;&#x6CE8;&#x89E3;&#x53EF;&#x4EE5;&#x4F5C;&#x7528;&#x4E8E;&#x65B9;&#x6CD5;&#x58F0;&#x660E; */</span>
    METHOD,

    <span class="hljs-comment">/** &#x6807;&#x660E;&#x8BE5;&#x6CE8;&#x89E3;&#x53EF;&#x4EE5;&#x4F5C;&#x7528;&#x4E8E;&#x53C2;&#x6570;&#x58F0;&#x660E; */</span>
    PARAMETER,

    <span class="hljs-comment">/** &#x6807;&#x660E;&#x6CE8;&#x89E3;&#x53EF;&#x4EE5;&#x4F5C;&#x7528;&#x4E8E;&#x6784;&#x9020;&#x51FD;&#x6570;&#x58F0;&#x660E; */</span>
    CONSTRUCTOR,

    <span class="hljs-comment">/** &#x6807;&#x660E;&#x6CE8;&#x89E3;&#x53EF;&#x4EE5;&#x4F5C;&#x7528;&#x4E8E;&#x5C40;&#x90E8;&#x53D8;&#x91CF;&#x58F0;&#x660E; */</span>
    LOCAL_VARIABLE,

    <span class="hljs-comment">/** &#x6807;&#x660E;&#x6CE8;&#x89E3;&#x53EF;&#x4EE5;&#x4F5C;&#x7528;&#x4E8E;&#x6CE8;&#x89E3;&#x58F0;&#x660E;(&#x5E94;&#x7528;&#x4E8E;&#x53E6;&#x4E00;&#x4E2A;&#x6CE8;&#x89E3;&#x4E0A;)*/</span>
    ANNOTATION_TYPE,

    <span class="hljs-comment">/** &#x6807;&#x660E;&#x6CE8;&#x89E3;&#x53EF;&#x4EE5;&#x4F5C;&#x7528;&#x4E8E;&#x5305;&#x58F0;&#x660E; */</span>
    PACKAGE,

    <span class="hljs-comment">/**
     * &#x6807;&#x660E;&#x6CE8;&#x89E3;&#x53EF;&#x4EE5;&#x4F5C;&#x7528;&#x4E8E;&#x7C7B;&#x578B;&#x53C2;&#x6570;&#x58F0;&#x660E;&#xFF08;1.8&#x65B0;&#x52A0;&#x5165;&#xFF09;
     * <span class="hljs-doctag">@since</span> 1.8
     */</span>
    TYPE_PARAMETER,

    <span class="hljs-comment">/**
     * &#x7C7B;&#x578B;&#x4F7F;&#x7528;&#x58F0;&#x660E;&#xFF08;1.8&#x65B0;&#x52A0;&#x5165;)
     * <span class="hljs-doctag">@since</span> 1.8
     */</span>
    TYPE_USE
}
</code></pre>
<p><strong>&#x5982;&#x679C; @Target &#x65E0;&#x6307;&#x5B9A;&#x4F5C;&#x7528;&#x57DF;, &#x5219;&#x9ED8;&#x8BA4;&#x53EF;&#x4EE5;&#x4F5C;&#x7528;&#x57DF;&#x4EFB;&#x4F55;&#x5143;&#x7D20;&#x4E0A;:</strong></p>
<pre><code class="lang-Java"><span class="hljs-meta">@Target</span>(value={CONSTRUCTOR, FIELD, LOCAL_VARIABLE, METHOD, PACKAGE, PARAMETER, TYPE})
</code></pre>
<h4 id="retention">@Retention</h4>
<p>&#x7528;&#x6765;&#x6307;&#x5B9A;&#x6CE8;&#x89E3;&#x7684;&#x751F;&#x547D;&#x5468;&#x671F;, &#x5B83;&#x6709;&#x4E09;&#x4E2A;&#x503C;, &#x5BF9;&#x5E94; RetentionPolicy &#x4E2D;&#x7684;&#x4E09;&#x4E2A;&#x679A;&#x4E3E;&#x503C;, &#x5206;&#x522B;&#x662F;: &#x6E90;&#x7801;&#x7EA7;&#x522B;( source ), &#x7C7B;&#x6587;&#x4EF6;&#x7EA7;&#x522B;( class ) &#x6216;&#x8005;&#x8FD0;&#x884C;&#x65F6;&#x7EA7;&#x522B;( runtime )</p>
<ul>
<li>SOURCE: &#x53EA;&#x5728;&#x6E90;&#x7801;&#x4E2D;&#x53EF;&#x7528;</li>
<li>CLASS: class&#x6587;&#x4EF6;&#x4E2D;&#x53EF;&#x7528; <strong>&#x5F53;&#x6CE8;&#x89E3;&#x672A;&#x5B9A;&#x4E49; Retention &#x503C;&#x65F6;</strong>, &#x9ED8;&#x8BA4;&#x503C;&#x662F; CLASS, </li>
<li>RUNTIME: &#x5728;&#x6E90;&#x7801;, class, &#x8FD0;&#x884C;&#x65F6;&#x5747;&#x53EF;&#x7528;, &#x56E0;&#x6B64;&#x53EF;&#x4EE5;&#x901A;&#x8FC7;&#x53CD;&#x5C04;&#x673A;&#x5236;&#x8BFB;&#x53D6;&#x6CE8;&#x89E3;&#x7684;&#x4FE1;&#x606F; ( &#x6E90;&#x7801;., class &#x6587;&#x4EF6;, &#x548C;&#x6267;&#x884C;&#x7684;&#x65F6;&#x5019;&#x90FD;&#x6709;&#x6CE8;&#x89E3;&#x7684;&#x4FE1;&#x606F; )</li>
</ul>
<h4 id="documented">@Documented</h4>
<p>&#x6267;&#x884C; javadoc &#x7684;&#x65F6;&#x5019;, &#x6807;&#x8BB0;&#x8FD9;&#x4E9B;&#x6CE8;&#x89E3;&#x662F;&#x5426;&#x5305;&#x542B;&#x5728;&#x751F;&#x6210;&#x7684;&#x7528;&#x6237;&#x6587;&#x6863;&#x4E2D;.</p>
<h4 id="inherited">@Inherited</h4>
<p>&#x6807;&#x8BB0;&#x8FD9;&#x4E2A;&#x6CE8;&#x89E3;<strong>&#x5177;&#x6709;&#x7EE7;&#x627F;&#x6027;</strong>, &#x6BD4;&#x5982; A &#x7C7B; &#x88AB; @Table &#x6807;&#x8BB0;, &#x800C; @Table &#x6CE8;&#x89E3;&#x88AB; @Inherited &#x58F0;&#x660E;  ( &#x5177;&#x5907;&#x7EE7;&#x627F;&#x6027; ); &#x7EE7;&#x627F; A&#x7C7B;&#x7684;&#x5B50;&#x7C7B;, &#x4E5F;&#x7EE7;&#x627F; @Table &#x6CE8;&#x89E3;</p>
<pre><code class="lang-Java"><span class="hljs-comment">//&#x58F0;&#x660E; Table &#x6CE8;&#x89E3;&#xFF0C;&#x6709;&#x7EE7;&#x627F;&#x6027;</span>
<span class="hljs-meta">@Inherited</span>
<span class="hljs-meta">@Target</span>(ElementType.TYPE)
<span class="hljs-meta">@Retention</span>(RetentionPolicy.RUNTIME)
<span class="hljs-keyword">public</span> <span class="hljs-meta">@interface</span> Table {

}
</code></pre>
<h3 id="&#x81EA;&#x5B9A;&#x4E49;&#x6CE8;&#x89E3;">&#x81EA;&#x5B9A;&#x4E49;&#x6CE8;&#x89E3;</h3>
<p>&#x9996;&#x5148;, &#x5B9A;&#x4E49;&#x6CE8;&#x89E3;&#x5FC5;&#x987B;&#x65F6; @Interface &#x4FEE;&#x9970;, &#x5176;&#x6B21;</p>
<ul>
<li>&#x6CE8;&#x89E3;&#x7684;&#x58F0;&#x660E;&#x5468;&#x671F; @Retention &#x4E00;&#x822C;&#x90FD;&#x662F; RUNTIME &#x8FD0;&#x884C;&#x65F6;</li>
<li>&#x6CE8;&#x89E3;&#x7684;&#x4F5C;&#x7528;&#x57DF; @Target</li>
<li>&#x662F;&#x5426;&#x9700;&#x8981;&#x6DFB;&#x52A0;&#x5143;&#x7D20; </li>
<li>&#x662F;&#x5426;&#x751F;&#x6210; javadoc @Documented</li>
</ul>

                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="027XML解析.html" class="navigation navigation-prev " aria-label="Previous page: 027XML解析">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="029 Lambda表达式.html" class="navigation navigation-next " aria-label="Next page: 029 Lambda表达式">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"028 注解","level":"2.1.30","depth":2,"next":{"title":"029 Lambda表达式","level":"2.1.31","depth":2,"path":"books/java/029 Lambda表达式.md","ref":"books/java/029 Lambda表达式.md","articles":[]},"previous":{"title":"027XML解析","level":"2.1.29","depth":2,"path":"books/java/027XML解析.md","ref":"books/java/027XML解析.md","articles":[]},"dir":"ltr"},"config":{"plugins":["search-pro","code","back-to-top-button","theme-comscore","intopic-toc","flexible-alerts","expandable-chapters"],"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"intopic-toc":{"selector":".markdown-section h1, .markdown-section h2, .markdown-section h3, .markdown-section h4, .markdown-section h5, .markdown-section h6","mode":"nested","maxDepth":6,"isCollapsed":true,"isScrollspyActive":true,"visible":true,"label":"In this article"},"search-pro":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"code":{"copyButtons":true},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"theme-comscore":{},"back-to-top-button":{},"flexible-alerts":{"style":"callout","note":{"label":"Note","icon":"fa fa-info-circle","className":"info"},"tip":{"label":"Tip","icon":"fa fa-lightbulb-o","className":"tip"},"warning":{"label":"Warning","icon":"fa fa-exclamation-triangle","className":"warning"},"danger":{"label":"Attention","icon":"fa fa-ban","className":"danger"}},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"expandable-chapters":{}},"theme":"default","author":"作者","lang":"zh-cn","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"isbn":"图书编号","variables":{},"title":"书名","gitbook":"*","description":"描述"},"file":{"path":"books/java/028 注解.md","mtime":"2022-10-19T08:32:12.361Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2023-03-01T12:24:55.135Z"},"basePath":"../..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../../gitbook/gitbook.js"></script>
    <script src="../../gitbook/theme.js"></script>
    
        
        <script src="../../gitbook/gitbook-plugin-search-pro/jquery.mark.min.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-search-pro/search.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-code/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-back-to-top-button/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-intopic-toc/anchor.min.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-intopic-toc/gumshoe.polyfills.min.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-intopic-toc/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-flexible-alerts/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-expandable-chapters/expandable-chapters.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-theme-comscore/test.js"></script>
        
    

    </body>
</html>

